const { assign } = Object

function omit (source, picks) {
  return Object.keys(source).reduce(
    (acc, cur) =>
      picks.includes(cur)
        ? acc
        : assign(acc, {
          [cur]: source[cur]
        }),
    {}
  )
}
function hasOwn (source, key) {
  return Object.hasOwnProperty.call(source, key)
}
function pick (source, picks) {
  // eslint-disable-next-line no-sequences
  return picks.reduce((acc, cur) => ((acc[cur] = source[cur]), acc), {})
}
function isPlainObject (tar) {
  return typeof tar === 'object' && Object.prototype.toString.call(tar) === '[object Object]'
}

export { assign, hasOwn, isPlainObject, omit, pick }
